package l.l.w.CodingInterviews;

import java.util.BitSet;
import java.util.Random;

/**
 * Created by llw on 2018/4/17/0017.
 */
public class _1千万个1到1亿的数_找出没有出现的数 {
    public static void main(String[] args) {
        int length = 100000000;
        int range = 1000000000;
        int[] arrays = new int[length];
        Random random = new Random();
        for(int i = 0; i < length; ++i){
            arrays[i] = random.nextInt(range);
        }
        BitSet bitSet = new BitSet(range);
        for(int i = 0; i < arrays.length; ++i){
            bitSet.set(arrays[i],true);
        }
        for(int i = 0; i < range; ++i){
            if(!bitSet.get(i))
                System.out.println(i);
        }
    }
}
